using LinqToExcel;

namespace DeploymentWang.Interfaces.Entities
{
    public abstract class ConfigSetting
    {
        [ExcelColumn(Name = "Environment")]
        public string Environment { get; set; }
        [ExcelColumn(Name = "Target")]
        public string Target { get; set; }
        [ExcelColumn(Name = "Namespace")]
        public string Namespace { get; set; }
        [ExcelColumn(Name = "Setting")]
        public string Setting { get; set; }
        [ExcelColumn(Name = "Value")]
        public string Value { get; set; }
        [ExcelColumn(Name = "Actions")]
        public string Actions { get; set; }

        public bool IsActionDefined(string action)
        {
            // not the best test but should suffice unless we want
            // to add actions that are substrings of another action
            // eg: "validate" and "date" <--- warning!
            return (Actions.ToLowerInvariant().Contains(action.ToLowerInvariant()));
        }
    }
}